import request from '/@/utils/request';

const workable_api = import.meta.env.VITE_WORKABLE_API as string;

/**
 * 获取计划任务管理列表
 * @param params 
 */
export function getWorkableTaskList(params?: object){
    return request({
        url: workable_api + '/task/list',
        method: 'get',
        params: params
    })
}

/**
 * 获取计划任务
 * @param params 
 */
export function getWorkableTask(params?: object){
    return request({
        url: workable_api + '/task/info',
        method: 'get',
        params: params
    })
}

/** 新增计划任务 */
export function addWorkableTask(params? : object){
    return request({
        url: workable_api + '/task/add',
        method: 'post',
        data: params
    });
}

/** 修改计划任务 */
export function editWorkableTask(params?: object) {
    return request({
        url: workable_api + '/task/edit',
        method: 'post',
        data: params
    });
}

/** 删除计划任务 */
export function delWorkableTask(params?: object){
    return request({
        url: workable_api + '/task/remove',
        method: 'post',
        data: params
    });
}

/** 部署计划任务 */
export function deployWorkableTask(params?: object){
    return request({
        url: workable_api + '/task/deploy',
        method: 'post',
        data: params
    });
}

/** 作废计划任务 */
export function trashWorkableTask(params?: object){
    return request({
        url: workable_api + '/task/trash',
        method: 'post',
        data: params
    });
}

/** 执行计划任务 */
export function runWorkableTask(params?: object){
    return request({
        url: workable_api + '/task/run',
        method: 'post',
        data: params
    });
}
